home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir24 / psi110g.zip / TWINVEC.ASM < prev    next >
Assembly Source File  |  1993-09-16  |  3KB  |  104 lines

  1. ;
  2. ; PackeTwin 8530 interrupt handler routine
  3. ;
  4. ;%   .MODEL  MEMMOD,C
  5. include asmglobal.h        
  6.     LOCALS
  7.     %MACS
  8.     .LALL
  9.  
  10.     extrn   Stktop,Spsave,Sssave,tsync_entpt:proc,eoi:proc,doret:proc
  11.  
  12.     .DATA
  13.  
  14.     .CODE
  15. dbase   dw      @Data           ; save loc for ds (must be in code segment)
  16.     
  17.     public  twinvec;
  18.  
  19.     label   twinvec far
  20. ;       cli
  21.     push    ds              ; save on user stack
  22.     mov     ds,cs:dbase     ; establish interrupt data segment
  23.  
  24.     mov     Sssave,ss       ; stash user stack context
  25.     mov     Spsave,sp
  26.  
  27.     mov     ss,cs:dbase
  28.     lea     sp,Stktop
  29.  
  30.     ; push    ax              ; save user regs on interrupt stack
  31.     ; push    bx
  32.     ; push    cx
  33.     ; push    dx
  34.     ; push    bp
  35.     ; push    si
  36.     ; push    di
  37.     PUSHALL
  38.     push    es
  39.     call    eoi
  40.     mov     ax,0            ; arg for service routine
  41.     push    ax
  42.     call    tsync_entpt
  43.     pop     ax
  44. ;       sti
  45.     jmp     doret
  46.  
  47. ; Write an 8530 register. Called from C as
  48. ; Twin_write_scc(int ctl,char reg,char val);
  49.     public  Twin_write_scc
  50. Twin_write_scc  proc
  51.     arg     ctl:word,reg:byte,val:byte
  52.     pushf
  53.     mov     dx,ctl
  54.     mov     al,reg
  55.     cmp     al,0
  56.     jz      @@doit          ; no need to set register 0
  57.  
  58. ;       cli                     ;9/22/91 DGL... don't do this... APPLICATIONS code MUST
  59. ;                               ;                               make sure they have ints disabled before
  60. ;                               ;                               calling us.
  61.  
  62.     out     dx,al   ; select the appropriate write register.
  63.  
  64.                 ;This code fixes a tiny race in the SCC Recovery Time Pal
  65.                 ;on the Twin
  66.     jmp @@doit      ;flush execution pipeline on 286/386    9/22/91 DGL
  67.     nop                     ;NOP is NECCESSARY so the jmp actually does the pipeline!!!!!
  68. @@doit: mov     al,val
  69.     out     dx,al
  70.     popf
  71.     ret
  72. Twin_write_scc  endp
  73.  
  74. ; Read an 8530 register. Called from C as
  75. ; Twin_read_scc(int ctl,char reg);
  76.     public  Twin_read_scc
  77. Twin_read_scc   proc
  78.     arg     ctl:word,reg:byte
  79.     pushf
  80.     mov     dx,ctl
  81.     mov     al,reg
  82.     cmp     al,0
  83.     jz      @@doit  ; no need to set reg if R0
  84.  
  85. ;       cli                     ;9/22/91 DGL... don't do this... APPLICATIONS code MUST
  86. ;                               ;                               make sure they have ints disabled before
  87. ;                               ;                               calling us.
  88.  
  89.     out     dx,al   ; select the appropriate write register.
  90.  
  91.                 ;This code fixes a tiny race in the SCC Recovery Time Pal
  92.                 ;on the Twin
  93.     jmp @@doit      ;flush execution pipeline on 286/386    9/22/91 DGL
  94.     nop                     ;NOP is NECCESSARY so the jmp actually does the pipeline!!!!!
  95. @@doit: in      al,dx
  96.     mov     ah,0
  97.     popf
  98.     ret
  99. Twin_read_scc   endp
  100.  
  101.     end
  102.  
  103.  
  104.